package io.renren.modules.sp.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.common.constant.Constant;
import io.renren.modules.sp.dao.SpBaseMatchItemGoupRefDao;
import io.renren.modules.sp.dto.SpBaseMatchItemGoupRefDTO;
import io.renren.modules.sp.entity.SpBaseMatchItemGoupRefEntity;
import io.renren.modules.sp.service.SpBaseMatchItemGoupRefService;
import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.sys.entity.SysDictDataEntity;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 赛项与组别的关系
 *
 * @author whc 15953295779@126.com
 * @since 3.0 2024-03-08
 */
@Service
public class SpBaseMatchItemGoupRefServiceImpl extends CrudServiceImpl<SpBaseMatchItemGoupRefDao, SpBaseMatchItemGoupRefEntity, SpBaseMatchItemGoupRefDTO> implements SpBaseMatchItemGoupRefService {

    @Override
    public QueryWrapper<SpBaseMatchItemGoupRefEntity> getWrapper(Map<String, Object> params){
        QueryWrapper<SpBaseMatchItemGoupRefEntity> wrapper = new QueryWrapper<>();
        if(StringUtils.isNotEmpty((String)params.get("matchItemId"))){
            wrapper.eq("match_item_id", params.get("matchItemId"));
        }
        wrapper.orderByDesc("id");
        return wrapper;
    }

    @Override
    public List<SysDictDataEntity> queryGroup(Long id){
        return this.baseDao.queryGroup(id);
    }


}
